package com.tk.exam.vo.exam;

import com.tk.exam.domain.TkExamInfo;
import com.tk.exam.utils.DateUtils;

import java.util.Date;

public class TkExamInfoExt extends TkExamInfo {
    //状态，1:未开始,2:进行中,3:已结束
    public static final byte EXAM_STATUS_BEFORE=1;
    public static final byte EXAM_STATUS_DOING=2;
    public static final byte EXAM_STATUS_AFTER=3;
    public TkExamInfoExt(UpExamReq req){
        this.setId(req.getId());
        this.setClassId(req.getClassId());
        this.setUpdateTime(new Date());
        this.setExamLocation(req.getExamLocation());
        this.setExamName(req.getExamName());
        this.setExamPaperId(req.getExamPaperId());
        this.setExamTime(DateUtils.parseStringTimesToDate(req.getExamTime()));
        this.setExamTotalTime(req.getExamTotalTime());
    }

    public TkExamInfoExt(){

    }
    public TkExamInfoExt getExtAdd(UpExamReq req){
        setClassId(req.getClassId());
        setCreateTime(new Date());
        setExamLocation(req.getExamLocation());
        setExamName(req.getExamName());
        setExamPaperId(req.getExamPaperId());
        setExamTime(DateUtils.parseStringTimesToDate(req.getExamTime()));
        setExamTotalTime(req.getExamTotalTime());
        setExamStatus(EXAM_STATUS_BEFORE);
        setUpdateTime(new Date());
        return this;
    }
}
